package gui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class FrmMain extends JFrame implements ActionListener {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;
	private JPanel titlePanel = null;
	private TextField m_commandString = null;
	private JPanel buttonPanel = null;
	private JButton m_submitButton = null;
	private JFrame m_primaryWindow;

	/**
	 * This is the default constructor
	 */
	public FrmMain() {
		super();
		initialize();
		
		this.m_primaryWindow = this;
	}
	
	public void actionPerformed(ActionEvent e)
	{
		JOptionPane.showMessageDialog(this, this.m_commandString.getText());
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(334, 121);
		this.setForeground(Color.blue);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBackground(new Color(180, 0, 0));
		this.setContentPane(getJContentPane());
		this.setTitle("Trimaxion Prototype");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
			jContentPane.add(getTitlePanel(), BorderLayout.NORTH);
			jContentPane.add(getButtonPanel(), BorderLayout.CENTER);
		}
		return jContentPane;
	}

	/**
	 * This method initializes titlePanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getTitlePanel() {
		if (titlePanel == null) {
			titlePanel = new JPanel();
			titlePanel.setLayout(new FlowLayout(FlowLayout.CENTER));
		}
		
		JLabel label = new JLabel("Please Enter Command: ");
		label.setFont(new Font("Arial", Font.BOLD, 12));
		label.setForeground(Color.BLUE);
		titlePanel.add(label);
		titlePanel.add(getM_commandString(), null);
		
		return titlePanel;
	}

	/**
	 * This method initializes m_commandString	
	 * 	
	 * @return java.awt.TextField	
	 */
	private TextField getM_commandString() {
		if (m_commandString == null) {
			m_commandString = new TextField();
			m_commandString.setColumns(20);
		}
		return m_commandString;
	}

	/**
	 * This method initializes buttonPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getButtonPanel() {
		if (buttonPanel == null) {
			buttonPanel = new JPanel();
			buttonPanel.setLayout(/*BoxLayout(buttonPanel, BoxLayout.X_AXIS)*/new FlowLayout(FlowLayout.CENTER));
			buttonPanel.add(getM_submitButton(), null);
		}
		return buttonPanel;
	}

	/**
	 * This method initializes m_submitButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getM_submitButton() {
		if (m_submitButton == null) {
			m_submitButton = new JButton();
			m_submitButton.setText("Submit");
			m_submitButton.addActionListener(this);
		}
		return m_submitButton;
	}

	// Main Method - Jon Price
	public static void main(String args[]) {
		FrmMain main = new FrmMain();
		main.setVisible(true);
	}
}  //  @jve:decl-index=0:visual-constraint="10,10"
